package com.sunrise.xdoc.view.system;

import org.primefaces.extensions.model.layout.LayoutOptions;

import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import java.io.Serializable;

/**
 * The Class HomeLayOut.
 *
 * @author Nguyen Duc Dung
 * @since 4/21/13 11:48 PM
 */

@ApplicationScoped
@ManagedBean(eager = true)
public class HomeLayout implements Serializable {

    private LayoutOptions layoutOptions;

    @PostConstruct
    protected void initialize() {
        layoutOptions = new LayoutOptions();

        // for all panes
        LayoutOptions panes = new LayoutOptions();
        panes.addOption("resizable", true);
        panes.addOption("closable", true);
        panes.addOption("slidable", false);
        panes.addOption("spacing", 6);
        panes.addOption("resizeWithWindow", false);
        panes.addOption("resizeWhileDragging", true);
        layoutOptions.setPanesOptions(panes);

        // north pane
        LayoutOptions north = new LayoutOptions();
        north.addOption("spacing_open", 0);
        layoutOptions.setNorthOptions(north);

        // south pane
        LayoutOptions south = new LayoutOptions();
        south.addOption("spacing_open", 0);
        layoutOptions.setSouthOptions(south);

        // west pane
        LayoutOptions west = new LayoutOptions();
        west.addOption("size", 250);
        west.addOption("minSize", 250);
        layoutOptions.setWestOptions(west);
    }

    public LayoutOptions getLayoutOptions() {
        return layoutOptions;
    }
}
